package com.example.xm.controller;

import com.example.xm.entity.Dizhientity;
import com.example.xm.entity.Typeentity;
import com.example.xm.service.DizhiService;
import com.example.xm.service.TypeService;
import com.example.xm.web.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/dizhi")
public class DizhiController {
    @Autowired
    DizhiService dizhiService;
    @PostMapping("/add")
    public Result reg(@RequestBody Dizhientity dizhientity){
        dizhiService.reg(dizhientity);
        return Result.success();
    }
    @GetMapping("/delete/{id}")
    public Result delete(@PathVariable Integer id){
        dizhiService.delete(id);
        return Result.success();
    }
    @GetMapping("/list")
    public Result list(Integer userId){
       List<Dizhientity> list= dizhiService.list(userId);
        return Result.success(list);
    }
}
